﻿// <copyright file="DictionaryWebdingConverter.cs" company="Microsoft Corporation">
// Copyright (c) 2008 All Right Reserved
// </copyright>
// <author>Michael S. Scherotter</author>
// <email>mischero@microsoft.com</email>
// <date>2009-03-06</date>
// <summary>Converst NTY Tag Dictionary names to Webding characters</summary>

namespace NYTimes.ValueConverters
{
    using System;
    using System.Windows;
    using System.Windows.Data;

    /// <summary>
    /// Converts the dictionary name to a webding symbol
    /// </summary>
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Webding", Justification = "Webdings is the name of a typeface.")]
    public class DictionaryWebdingConverter : IValueConverter
    {
        #region IValueConverter Members

        /// <summary>
        /// Converts a <see cref="NYTimes.Data.Tag"/>.Dictionary to a Webdings character
        /// </summary>
        /// <param name="value">The source data being passed to the target </param>
        /// <param name="targetType">The Type of data expected by the target dependency property.</param>
        /// <param name="parameter">An optional parameter to be used in the converter logic.</param>
        /// <param name="culture">The culture of the conversion.</param>
        /// <returns>The value to be passed to the target dependency property. </returns>
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string dictionary = value as string;

            switch (dictionary)
            {
                case "Des":
                    return "i";
                case "Geo":
                    return "ü";
                case "Org":
                    return "F";
                case "Per":
                    return "";
            }

            return string.Empty;
        }

        /// <summary>
        /// Not Implemented
        /// </summary>
        /// <param name="value">The target data being passed to the source.</param>
        /// <param name="targetType">The Type of data expected by the source object.</param>
        /// <param name="parameter">An optional parameter to be used in the converter logic. </param>
        /// <param name="culture">The culture of the conversion.</param>
        /// <returns>The value to be passed to the source object.</returns>
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return DependencyProperty.UnsetValue;
        }

        #endregion
    }
}
